const log = (info) => {
  var d = new Date()
  console.log(d.toLocaleTimeString(), info)
}
async function f1 () {
  const p1 = new Promise((resolve, reject) => {
    setTimeout(() => resolve(100), 3000)
  })
  const r = await p1
  log(r + 1)
  return r + 1
}

async function f2 () {
  const p1 = new Promise((resolve, reject) => {
    setTimeout(() => resolve(200), 3000)
  })
  const r = await p1
  log(r + 1)
  return r + 1
}

async function f () {
  log('开始')
  // const r1 = await f1()
  // const r2 = await f2()
  // const [r1, r2] = await Promise.all([f1(), f2()])
  // console.log(r1, r2)

  const _f1 = f1()
  const _f2 = f2()
  const r1 = await _f1
  const r2 = await _f2
  console.log(r1, r2)

  log('end')
}

f()
